@extends('layouts.home')
@extends('layouts.nav')
@extends('layouts.top')

@section('css')
    <link rel="stylesheet" type="text/css" href="{{ asset('files/css/bootstrap-fileupload.min.css') }}"/>
@endsection

@section('heading')
    <h3>
        系统设置
    </h3>
    <ul class="breadcrumb">
        <li>
            <a href="#">微信配置</a>
        </li>
        <li class="active"> 微信配置</li>
    </ul>
@endsection


@section('wrapper')
    @include('share.error')
    <section class="panel">

        <div class="panel-body">
            <div class=" form">
                <form method="POST" action="{{ route('wechat.store') }}" class="cmxform form-horizontal adminex-form"
                      enctype="multipart/form-data">
                    @csrf
                    <div class="form-group ">
                        <label for="cname" class="control-label col-lg-2">AppId</label>
                        <div class="col-lg-5">
                            <input class=" form-control{{ $errors->has('app_id') ? ' error' : '' }}" id="capp_id"
                                   value="{{ $wechat->app_id or old('app_id') }}" name="app_id" minlength="2"
                                   type="text" required/>
                            @if ($errors->has('app_id'))
                                <label class="error">{{ $errors->first('app_id') }}</label>
                            @endif
                        </div>
                    </div>
                    <div class="form-group ">
                        <label for="cname" class="control-label col-lg-2">Secret</label>
                        <div class="col-lg-5">
                            <input class=" form-control{{ $errors->has('secret') ? ' error' : '' }}" id="csecret"
                                   value="{{ $wechat->secret or old('secret') }}" name="secret" minlength="2"
                                   type="text" required/>
                            @if ($errors->has('secret'))
                                <label class="error">{{ $errors->first('secret') }}</label>
                            @endif
                        </div>
                    </div>
                    <div class="form-group ">
                        <label for="cname" class="control-label col-lg-2">商户ID</label>
                        <div class="col-lg-5">
                            <input class=" form-control{{ $errors->has('mch_id') ? ' error' : '' }}" id="cmch_id"
                                   value="{{ $wechat->mch_id or old('mch_id') }}" name="mch_id" minlength="2"
                                   type="text" required/>
                            @if ($errors->has('mch_id'))
                                <label class="error">{{ $errors->first('mch_id') }}</label>
                            @endif
                        </div>
                    </div>
                    <div class="form-group ">
                        <label for="cname" class="control-label col-lg-2">商户支付秘钥</label>
                        <div class="col-lg-5">
                            <input class=" form-control{{ $errors->has('mch_key') ? ' error' : '' }}" id="cmch_key"
                                   value="{{ $wechat->mch_key or old('mch_key') }}" name="mch_key" minlength="2"
                                   type="text" required/>
                            @if ($errors->has('mch_key'))
                                <label class="error">{{ $errors->first('mch_key') }}</label>
                            @endif
                        </div>
                    </div>
                    <div class="form-group last">
                        <label class="control-label col-md-2">CA证书</label>
                        <div class="col-md-9">
                            <div class="fileupload fileupload-new" data-provides="fileupload">
                            <span class="btn btn-default btn-file" style="margin-left: 0px;">
                                <span class="fileupload-new" style="margin-left: 0px;"><i class="fa fa-paper-clip"></i> 选择文件</span>
                                <span class="fileupload-exists" style="margin-left: 0px;"><i class="fa fa-undo"></i> 重选</span>
                                <input type="file" name="ca_cert" class="default"/>

                            </span>
                                <span class="fileupload-preview" style="margin-left:5px;">{{ $wechat->ca_cert or ''}}</span>
                                <a href="#" class="close fileupload-exists" data-dismiss="fileupload"
                                   style="float: none; margin-left:5px;"></a>
                            </div>
                            <br/>
                            @if ($errors->has('ca_cert'))
                                <label class="error">{{ $errors->first('ca_cert') }}</label>
                            @endif
                        </div>
                    </div>
                    <div class="form-group last">
                        <label class="control-label col-md-2">应用Key</label>
                        <div class="col-md-9">
                            <div class="fileupload fileupload-new" data-provides="fileupload">
                        <span class="btn btn-default btn-file" style="margin-left: 0px;">
                            <span class="fileupload-new" style="margin-left: 0px;"><i class="fa fa-paper-clip"></i> 选择文件</span>
                            <span class="fileupload-exists" style="margin-left: 0px;"><i
                                        class="fa fa-undo"></i> 重选</span>
                            <input type="file" name="apiclient_key" class="default"/>

                        </span>
                                <span class="fileupload-preview" style="margin-left:5px;">{{ $wechat->apiclient_key or ''}}</span>
                                <a href="#" class="close fileupload-exists" data-dismiss="fileupload"
                                   style="float: none; margin-left:5px;"></a>
                            </div>
                            <br/>
                            @if ($errors->has('apiclient_key'))
                                <label class="error">{{ $errors->first('apiclient_key') }}</label>
                            @endif
                        </div>
                    </div>
                    <div class="form-group last">
                        <label class="control-label col-md-2">应用证书</label>
                        <div class="col-md-9">
                            <div class="fileupload fileupload-new" data-provides="fileupload">
                                    <span class="btn btn-default btn-file" style="margin-left: 0px;">
                                        <span class="fileupload-new" style="margin-left: 0px;"><i
                                                    class="fa fa-paper-clip"></i> 选择文件</span>
                                        <span class="fileupload-exists" style="margin-left: 0px;"><i
                                                    class="fa fa-undo"></i> 重选</span>
                                        <input type="file" name="apiclient_cert" class="default"/>

                                    </span>
                                <span class="fileupload-preview"
                                      style="margin-left:5px;">{{ $wechat->apiclient_cert or ''}}</span>
                                <a href="#" class="close fileupload-exists" data-dismiss="fileupload"
                                   style="float: none; margin-left:5px;"></a>
                            </div>
                            <br/>
                            @if ($errors->has('apiclient_cert'))
                                <label class="error">{{ $errors->first('apiclient_cert') }}</label>
                            @endif
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-10">
                            <button class="btn btn-primary" type="submit">保存</button>
                        </div>
                    </div>
                </form>
            </div>

        </div>
    </section>
@endsection

@section('js')
    <script type="text/javascript">
        var ue = UE.getEditor('container');
        ue.ready();
    </script>
    <script type="text/javascript" src="{{ asset('files/js/bootstrap-fileupload.min.js') }}"></script>
@endsection